﻿using HYBY.Task.Service.IService;
using HYBY.WebFrameWork.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Web.Models;

namespace Web.Controllers
{
    public class StructureController : BaseController
    {
        private readonly ITAStructureService _service;

        private readonly ITADictionariesService _dic_service;

        private readonly ITAOrganizationService _org_service;



        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="service"></param>
        /// <param name="dic_service"></param>
        public StructureController(ITAStructureService service, ITADictionariesService dic_service, ITAOrganizationService org_service)
        {
            _service = service;
            _dic_service = dic_service;
            _org_service = org_service;
        }
        //组织架构
        // GET: /Structure/
        public ActionResult Index()
        {
            var model = new TAStructureModel();

            //获得字典数据
            model.LiTADictionariesM = _dic_service.GetTADictionariess();
            //获得组织数据
            model.LiTAStructureM = _service.GetTAStructures();
            //满编人员
            model.LiTAOrganizationM = _org_service.GetTAOrganizations();

            //统计列表
            model.TAStructureStatisticsM = _service.GetTAStructureStatisticsList();

            ViewBag.GetDepartment = GetDepartment();
            ViewBag.GetPosition = GetPosition();

            return View(model);
        }

        /// <summary>
        /// 1=研发 2=UED 3=开发 4=测试 5=应用
        /// </summary>
        /// <returns></returns>
        public Dictionary<int,string> GetDepartment()
        {
            
            var dic = new Dictionary<int, string>();

            dic.Add(1, "研发");
            dic.Add(2, "UED");
            dic.Add(3, "开发");
            dic.Add(4, "测试");
            dic.Add(5, "应用");

            return dic;
        }

        public Dictionary<int,string> GetPosition()
        {
            var dic = new Dictionary<int, string>();

            dic.Add(1, "经理");
            dic.Add(2, "主管");
            dic.Add(3, "开发"); 

            return dic;
        }
    }
}